RK3326: add GKD Pixel 2 (Device b) support#2993
Conversation
|
This looks like too large modification for supporting just one device. |
|
Kernel patches look like they are implemented by LLM. Why not port these patches to mainline? |
|
I'll can trim down and remove the unnecessary source edits, as well as any excess patch files. I have been referencing the px30s source code from the BSP 6.1 when making these edits, but we can definitely import these driver files outright. That is a better idea. |
Hi, in fact I also spent some time on RK3326s before with another device GameMT E6. In my fork, I can boot the 3326s device with bsp 6.6 kernel. And the basic funcionality works properly. The only leftover is after suspend, the device will not recognize the USB port and something wrong with devfreq. update: |
|
If I am not mistaken, wouldn't the ROCKNIX dev's want the ROCKNIX kernel to be built and compatible with this device? Many other distributions (ROGUE OS, Knulli) leverage the BSP Kernel. While this is fine, I am not sure this is satisfactory for mainline ROCKNIX. The problems we are having stem directly from porting to the ROCKNIX kernel. I can definitely look at your code as a reference and use it to help make an "RK3326S" device in the devices list. |
|
@stolen With the help of r3claimer we have the screen working, and have confirmed the Audio, USB, and Buttons are all working. I have also attempted to minimize any excess modification to the ROCKNIX source tree, and have imported the necessary PX30S patches from their BSP tree. |
|
Here is the logic to add LED controlls to the dts. Luckily they are just basic GPIO. I believe they will show in /sys/class/leds/brightnessX. Just adding to the dts turns them all on by default. Echo just a 0 or a 1 should turn them on and off. Ideal would be to create a script that showed the remaining battery percentage relflect in number of leds lit up. |
|
We have enabled GPIO LED control for the GKD Pixel2. Added a |
|
Important: resume-from-sleep is still NOT working correctly on the GKD Pixel2. The device suspends fine but does not wake. Investigation update: found the likely root cause via the vendor rockchip-linux/kernel tree - on PX30S, the deepest suspend modes are governed by ATF/BL31 firmware, not Linux. Added |
|
Ready for alpha testing. Summary of where things stand:
@stolen @r3claimer - given the volume of changes, would appreciate eyes on this whenever you have a chance, especially the wake-from-sleep investigation if either of you has PX30S/ATF firmware insight. |
|
GKD Pixel2 is now merged into Device B — subdevice "c" has been removed entirely. Its u-boot/kernel/system payload was already identical to subdevice b's, so the only real difference was dtb selection. Since Pixel2 has no analog stick wired to the SARADC channel the existing ADC-hwid mechanism relies on (that pin floats and can land in any board's range on a given boot), Verified working on real hardware. |
|
Alpha 1.0 - feature complete. 🎉 GKD Pixel2 support has since been merged into subdevice b (no longer a separate subdevice c) with hardware-silicon-register-based DTB selection, so it coexists cleanly with the other RK3326 "b" boards without any impact on them. Working: display, audio, RTL8188EUS WiFi dongle, USB peripherals (keyboard/storage etc. via the OTG port - now correctly powers what's plugged in), all buttons (A/B swap fixed), battery status LEDs, battery/fuel-gauge reporting, standalone-emulator input controls across all bundled apps. Last remaining TO-DO: wake-from-sleep still doesn't work correctly - proper suspend-to-memory needs further investigation. A temporary Release with SD card image + update tar: https://github.com/Jacob-Matthew-Cook/distribution/releases/tag/pixel2-alpha-1.0 |
|
Update: fixed a regression introduced by the USB Root cause: the shared RK3326 Release assets updated in place: https://github.com/Jacob-Matthew-Cook/distribution/releases/tag/pixel2-alpha-1.0 |
|
Wrapping up this development pass — Alpha 1.1 to follow. We're done with our current round of work on the Pixel2 and would like to get this merged before starting on more complex features, so that work can build on a merged baseline rather than an ever-growing fork branch. Since the last update, we've added:
Known "nice to haves" for follow-up work (not blocking this merge):
Let us know if there's anything else needed before merge. |
6b80a7a to
6fee235
Compare
|
Update on the rumble motor: the long-standing "always on from boot" issue is partially fixed. Root cause found via live-hardware register testing: the vendor-extracted The remaining piece is fixed with a small EDIT: I have properly fixed it. For some reason on the Pixel2, pwm0 was in the joypad, when it is supposed to be managed by pwm-vibra. I still need a patch at boot to initialize the pwm0 on the Pixel2 to off, but by using this module, we have made it appear almost immediately in the boot process. |
|
Alpha 1.2 - PWM rumble mostly resolved. Following up on the rumble motor issue: it's now fixed via a small kernel patch (
Uploading this now as Alpha 1.2. Remaining known issues:
This is intended to be the last major Alpha release before this gets merged into mainline - further fixes for the two items above would ideally happen post-merge rather than continuing to grow this branch further. |
Great work! Some comments. Regarding the vibration, I assume just adding things like that pwm and set pwm0 as okay should be fine. Nothing special is needed. At least from my 5.10 port which uses the same driver. My LLVM also added a special patch for otg switch, maybe as reference. And spleep suspend usually strong related to u-boot. |
|
Wake-from-sleep is fixed. Root cause: the earlier suspend-mode-config port only forwarded New follow-up issue found in the process: the system crashes a few seconds after waking. Investigating separately - will update here once resolved. |
|
Quick update: found and fixed a real bug where the GKD Pixel2 (PX30S) was running its CPU/GPU on generic PX30 voltage tables, overvolting the silicon at every frequency step. Corrected OPP tables are in now, with vendor's full frequency range and a safety margin validated on hardware. Still actively working on getting resume-from-suspend fully stable - wakes correctly now, but a hang a few seconds after resume remains under investigation. |
9e4e3a7 to
c1bb86d
Compare
Alpha 1.3 (Final) is complete - proper suspend-to-memory now SEMI workingDeep suspend/resume (real
The The only remaining known issue is out of scope for this PR: USB-OTG state transitions aren't fully robust - the port can get stuck in either a "Host" or "Peripheral" configuration depending on what was plugged in most recently, requiring a device reset to recover. Left for follow-up work post-merge. Alpha 1.3 build artifacts (flashable image + update tar, with checksums): https://github.com/Jacob-Matthew-Cook/distribution/releases/tag/pixel2-alpha-1.3 |
|
@Jacob-Matthew-Cook I tested the Alpha 1.3 build on real hardware. The first boot was completely normal. However, after changing the language and timezone in the Settings and performing a restart, the device gets stuck on a black screen (the backlight is on, but there is no display) right after the boot logo. |
You're right, I am noticing sometimes that the screen does this sometimes after restarting. Thanks for testing. I am not sure if this is some issue with the panel timing or the device internals not fully resetting and being in a weird state (the latter is my current theory). I have also updated the Alpha with our findings today that deep suspend does not work completely, and have since readded the necessary quirk file for freeze to be the default. If your screen is completely black, fully power cycle the device, or suspend-then-resume. It is not the most elegant solution, but we will want to troubleshoot the display drivers a bit more as well. @stolen I think this branch is ready for merge into nightly, if you're up for it? |
|
Spent some time auditing every PX30S-specific difference in the vendor BSP kernel ( Found and fixed one real gap: Everything else already covered, for completeness:
One architectural difference with no fix planned, just noting it: the vendor BSP has an entire subsystem ( |
I think I found the issue. There were a few errors in the panel dts description provided by @stolen, which have been fixed. I am updating Alpha 1.3 again in-place, but I am placing the vendor CPU and GPU opp tables in place (which can go to much lower power levels). The sleep issues seem to be some combination of voltage changing much too quickly for this chip following resume, which we haven't fully characterized. I will need to keep testing @labac-dev, but the in-place Alpha 1.3 update should fix the display. I highly encourage people to try debugging and testing the system via SSH over USB (or UART, if they want to get panics closer the the kernel failure). Given the RAM can corrupt during voltage transitions, it is unlikely the UART can catch the exact cause of failure. If the system is left in performance mode or powersave mode, suspend to memory works. Do be careful, as ondemand and schedutil can cause the system to crash following resume. Lastly, you may notice overclocking from stock settings may reboot your device. If that is the case, you should enable CPU performance mode first, and THEN set the CPU overclock. |
|
Did you implement TEO/Uclamp stack with Schedutil?s - I had to adjust the polling rate down of the freq to be stable for the xf40h and rk3566 work I was doing a few months to get stable results, the defaults poll too aggressively and trigger freq changes which cause crashes . schedutils is probably the right govt in general once dialed in with systemd and TEO, but you need the whole uclamp/teo/cgroupv2 stack setup properly. There should be some discussion on this buried in github from a few months back. |
I don't think I have TEO/Uclamp stack implemented. Also, the issue occurs with either Schedutil or Ondemand. I'll look into your points. How critical is BL32 in your opinion? PR#2360 is eerily similar to what we are working through right now... very interesting: |
|
Yes - the DMC freq selection was part of what I took further and
implemented; it's not really as relevant on the rk3326 as on the 3566. bl32
isn't relevant it was a red herring IIRC. There is probably some more
advanced branches in my github repos.
…On Fri, 17 Jul 2026 at 13:54, Jacob Cook ***@***.***> wrote:
*Jacob-Matthew-Cook* left a comment (ROCKNIX/distribution#2993)
<#2993 (comment)>
Did you implement TEO/Uclamp stack with Schedutil?s - I had to adjust the
polling rate down of the freq to be stable for the xf40h and rk3566 work I
was doing a few months to get stable results, the defaults poll too
aggressively and trigger freq changes which cause crashes . schedutils is
probably the right govt in general once dialed in with systemd and TEO, but
you need the whole uclamp/teo/cgroupv2 stack setup properly. There should
be some discussion on this buried in github from a few months back.
I don't think I have TEO/Uclamp stack implemented. Also, the issue occurs
with either Schedutil or Ondemand. I'll look into your points. How critical
is BL32 in your opinion?
PR#2360 is eerily similar to what we are working through right now... very
interesting:
#2360 <#2360>
—
Reply to this email directly, view it on GitHub
<#2993?email_source=notifications&email_token=AACF5L4YJ5J7U3I647YP4Q35FGBNBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJZHAZDENJXGI22M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4998225725>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACF5L7TCRF76BE5ZGFTOGL5FGBNBAVCNFSNUABFKJSXA33TNF2G64TZHM3TOMJRGIYDAMRRHNEXG43VMU5TIOBTGI2DIMZWGA3KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AACF5L5JUZCI7OIDHEO4FIT5FGBNBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJZHAZDENJXGI22M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AACF5L72RXIN3HJ36KIB4735FGBNBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJZHAZDENJXGI22M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you commented.Message ID:
***@***.***>
|
Interesting. Just a heads up, the Pixel2 uses the RK3326-S variant (not the RK3326 base), which is somewhat modernized and has overall better power performance (with a few newer features). It can support faster RAM if I am not mistaken, and I think it may have some similar structural aspects to newer SoCs from Rockchip. I'll keep looking into this as I have time. If you have any technical input regarding DVFS on the Rockchip SoCs, that would be appreciated. |
|
@stolen I think we are ready to merge, if you are? I will need to solve the DRAM corruption in a separate PR, as discussed on Discord. Thank you for all the time and help! |
Rebase your PR and remove the merge commits. |
d7ea51c to
7eaa98f
Compare
I think I fixed it now? If there are other issues please let me know. I'm still a bit new to this, so thanks for walking me through this. |
|
@spycat88 I'm not familiar with github PR features. Can we squash the entire PR while accepting it? |
You can, but we disabled it, is that something you really want to do? The PR author can also do this themselves and force push the change to the PR. |
I can squash the commit history, I am fine with that. |
Adds a mainline/ROCKNIX-style board port for the GameKiddy GKD Pixel2 (RK3326S/PX30S), reconstructed from the vendor-extracted devicetree on top of the shared rk3326.dtsi, alongside the U-Boot and kernel-side fixes needed for it to work reliably. Devicetree / display: - Board dts with panel, input, LED, and OPP wiring specific to this board. Panel uses the rocknix,generic-dsi driver (already used by other RK3326 boards) with an init sequence reconstructed from the vendor-extracted panel-init-sequence and trimmed to the single validated 480x640@60Hz mode. - GPIO LED control for the five battery-indicator LEDs. - Board-local CPU/GPU/DMC OPP tables using this board's own real, vendor-validated voltages, confirmed against the vendor's own decompiled devicetree (this board's real firmware uses the generic PX30 tables rather than lower-voltage PX30S-suffixed ones some other porting attempts assume). The 1512MHz CPU turbo step is disabled - it can trigger a full device reset on its own, confirmed by direct reproduction. Kernel (PX30S-specific fixes ported from the vendor BSP kernel, each gated on soc_is_px30s() so other RK3326/PX30 boards are unaffected): - TSADC support, GPU power-domain workaround (a clock double- management bug between genpd's automatic GENPD_FLAG_PM_CLK tracking and mali_kbase's own direct clock management, confirmed via live dmesg to cause "Enabling unprepared clk_gpu" / -ESHUTDOWN during real resume - genpd no longer tracks the GPU domain's clock on PX30S), DSI D-PHY timing table, cpuinfo SoC detection, IO-domain pmuio1 fix, USB2 PHY tuning, OTP active/standby read protocol (mainline otherwise always uses the wrong, plain-PX30 read path), CPU/GPU wake/suspend-mode SIP configuration for firmware-controlled deep suspend states, and DDR PHY/OTP clock topology (PX30S's clk_ddrphy1x is independently muxed/divided rather than a fixed /4 of clk_ddrphy4x, and clk_stdby_2wrap runs at a quarter of clk_ddrphy1x's rate rather than the same rate). - Rumble via the mainline pwm-vibrator driver, with a fix for a stuck-on-boot PWM state. With the suspend/resume and OPP fixes above, deep suspend (not just s2idle) works on this hardware. However, real hardware testing found a separate, unresolved bug: if a dynamic CPU governor (schedutil/ ondemand) is active after resume, the system reliably crashes within seconds (confirmed memory corruption - a real page-table translation fault), needing both a CPU frequency/voltage transition and concurrent memory-management activity to manifest. Static governors and a fresh boot are unaffected - only post-resume with a dynamic governor is. Until this is root-caused, this board defaults to "freeze" (s2idle) suspend instead of deep suspend, sidestepping the corruption path rather than fixing it (same mechanism RK3576 uses for the same class of issue). U-Boot: - k36-clone-with-emmc-rk3326 support, OTP support removed (not needed once the kernel-side OTP read protocol above works), and the ADC-based download-key false-trigger disabled via Kconfig (this board has no analog stick, so the floating SARADC channel otherwise reads as "key pressed"). Known open issues, not resolved by this PR: - Rumble motor can get stuck on (PWM channel boots enabled/inverted/ duty==period) in some cases. - The post-resume dynamic-governor memory corruption described above; DMC/DRAM frequency-scaling work to investigate it is being tracked separately. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
7eaa98f to
59d4771
Compare
Summary
b.soc_is_px30s()detection helper ported from the vendor's own cpuinfo infrastructure.sitronix,st7701in the vendor tree if using a non-generic driver. Its DSIreset-gpiospolarity was also wrong (active-low instead of active-high), so the panel was being told to exit reset every boot and instead held in it the whole time - it never processed a single DSI command, which is why the backlight came on but the screen stayed black. Adds a propergkd,pixel2-panelentry to mainline'spanel-sitronix-st7701.cwith correct reset/enable GPIO sequencing for this IC family.es_input.cfg) and RetroArch autoconfig entries (previously missing entirely for this board), an A/B button swap fix, and GPIO battery-status LED support (4 green + 1 yellow, percentage-tiered).Testing
PWM_LOCK_ENhold time).AI Usage
Did you use AI tools to help write this code? YES, Claude. Most code has been adapted from BSP sources and the recommended vendor DTS settings.